< previous page page_312 next page >

Page 312
The DefaultUser and DefaultPassword properties are covered when you learn about the Workspace data-access object.
The DBEngine Object Methods
We'll cover six of the Visual Basic methods that are associated with the DBEngine data-access object:
·RepairDatabase is used to fix corrupted Microsoft Jet database files.
·CompactDatabase is used to clean up, and also convert, existing Microsoft Jet databases.
·RegisterDatabase is used to create a link between an external data source and an existing Microsoft Jet database.
·Idle is used to force Visual Basic to pause processing while the DBEngine updates the contents of any existing data access objects.
·SetOption is used to modify one or more of the Microsoft Jet Registry settings at runtime.
·CreateWorkspace is used to establish a workspace for accessing one or more databases. You'll learn about this method in the section on Workspace objects later in this chapter.
Using the RepairDatabase Method
You can use the RepairDatabase method to fix corrupted Microsoft Jet database files. The default syntax to invoke this method is
DBEngine.RepairDatabase databasename
Add another command button to the current project. Place it at the bottom of the screen. Set its Name property to cmdDBRepair and its Caption property to DBRepair. Add a CommonDialog control to the form and then enter the code in Listing 9.3.
Type.gifListing 9.3. Coding the cmdDBRepair_Click event.
Private Sub cmdDBRepair_Click()
    '
    ' fix a corrupted db
    '
    Dim strDBName As String
    '
    CommonDialog1.ShowOpen
    strDBName = CommonDialog1.filename
    '
    If strDBName <> "" Then

 
< previous page page_312 next page >

If you like this book, buy it!